package com.xuanyuan.baselibaray

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

/**
 * @author luofaxin
 */
abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
    /**
     * layout 引用
     */
    protected lateinit var mBinding: T

    /**
     * 返回布局的id
     * 【警告:】布局.xml必须支持databinding
     */
    protected abstract fun initLayout(): Int

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        mBinding = DataBindingUtil.setContentView(this, initLayout())


        // LayoutId 未知是否支持databinding 时使用
//        mBinding = DataBindingUtil.inflate(layoutInflater, initLayout(), null, false);
    }
}